package com.tang.algorithm.ordinary;

import java.util.ArrayList;
import java.util.List;

/**
 * @author tlm
 * @version 1.0
 * @date 2020/6/17 21:21
 */
public class LeetCode728 {
    public List<Integer> selfDividingNumbers(int left, int right) {
        List<Integer> list = new ArrayList<>();

        for(int i = left ; i <= right ;i ++){
            int num = i;
            while(num != 0){
                if(num % 10 == 0){
                    break;
                } else if(i % (num % 10) != 0){
                    break;
                }
                num = num /10;

            }
            if(num == 0){
                list.add(i);
            }
        }
        return list;
    }
}
